package calendar;

/**
 *
 * @author angelika
 */
public class Date {
    public Integer day;
    public Integer month;
    public Integer year;
    
    public Date(String dateString) {
        fromString(dateString);
    }
    
    public Date(int day, int month, int year) {
        this.day = day;
        this.month = month;
        this.year = year;
    }
    
    public Date() {
        day = 0;
        month = 0;
        year = 0;
    }
    
    public void fromString(String dateString) {
        String[] parts;
        parts = dateString.split("-", 3);
        day = Integer.parseInt(parts[0]);
        month = Integer.parseInt(parts[1]);
        year = Integer.parseInt(parts[2]);
    }
    
    @Override
    public String toString() {
        return day.toString() + "-" + month.toString() + "-" + year.toString();
    }
}
